import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LayoutView from '../views/LayoutView.vue'
import LoginView from "../views/LoginView.vue"
import ProductListView from "../views/ProductListView.vue"
import ProductAddView from "../views/ProductAddView.vue"
import CarouselListView from "../views/CarouselListView.vue"
import CarouselAddView from "../views/CarouselAddView.vue"
import UserView from '@/views/UserView.vue'
import AdminManageView from '@/views/AdminManageView.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: LayoutView,
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: HomeView,
        },
        {
          path: '/prolist',
          name: 'prolist',
          component: ProductListView,
        },
        {
          path: '/proadd',
          name: 'proadd',
          component: ProductAddView,
        },
        {
          path: '/carlist',
          name: 'carlist',
          component: CarouselListView,
        },
        {
          path: '/caradd',
          name: 'caradd',
          component: CarouselAddView,
        },
        {
          path: '/user',
          name: 'user',
          component: UserView,
        },
        {
          path: '/adminmanage',
          name: 'adminmanage',
          component: AdminManageView,
        },
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },

  ],
})

export default router
